package com.huishao.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huishao.demo.mapper.ImagesMapper;
import com.huishao.demo.entity.Images;
import com.huishao.demo.service.ImagesService;
import org.springframework.stereotype.Service;
import com.huishao.demo.common.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huishao.demo.utils.MybatisPlusUtil;

/**
 * (Images)表服务实现类
 *
 * @author huishao
 * @since 2023-02-17 13:55:42
 */
@Service("imagesService")
public class ImagesServiceImpl extends ServiceImpl<ImagesMapper, Images> implements ImagesService {

    @Override
    public PageResult getPage(Integer currentPage, Integer size, Images images) {
        Page<Images> page = new Page<>(currentPage, size);

        QueryWrapper<Images> queryWrapper = MybatisPlusUtil.queryWrapperBuilder(images);

        this.page(page, queryWrapper);

        return new PageResult((int) page.getTotal(), page.getRecords());
    }
}

